package blue.qingyu.whimurmur.messageEx.directive;

import com.jfinal.aop.Inject;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.template.Env;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;

import blue.qingyu.whimurmur.messageEx.model.WMPostClass;
import blue.qingyu.whimurmur.messageEx.service.WMPostClassService;
import io.jboot.db.model.Columns;
import io.jboot.web.directive.base.JbootDirectiveBase;

public class WMPostCategoryDirective extends JbootDirectiveBase {
	@Inject
	private WMPostClassService postClassService;
	
	@Override
	public void onRender(Env env, Scope scope, Writer writer) {
		Integer page = getParaToInt("page", scope, 1);
		Columns columns = Columns.create();
		Page<WMPostClass> postClassPage = postClassService._paginate(page, 10, columns);
		
        scope.setGlobal("clubCategory", postClassPage);
        renderBody(env, scope, writer);
	}

	@Override
    public boolean hasEnd() {
        return true;
    }

}
